package com.andy.qi.domain.room;

import javax.persistence.AttributeConverter;

import com.andy.qi.util.Json;

public class SeatsConverter implements AttributeConverter<Seat[], String> {

    @Override
    public String convertToDatabaseColumn(Seat[] attribute) {
        return attribute == null ? null : Json.toJson(attribute);
    }

    @Override
    public Seat[] convertToEntityAttribute(String dbData) {
        return dbData == null ? null : Json.fromJson(dbData, Seat[].class);
    }

}
